from pages.base_page import BasePage


class ShoeGuidePage(BasePage):
    yeezy_button = '//*[@text="YEEZY"]'
    yeezy_350_button = '//*[@resource-id="cool.dingstock.mobile:id/section_rv"]/android.view.ViewGroup[1]/androidx.recyclerview.widget.RecyclerView[1]/android.widget.LinearLayout[1]/android.widget.TextView[1]'
    first_yeezy350_detail_name = '//*[@resource-id="cool.dingstock.mobile:id/name_tv"]'
    detail_back = '//*[@resource-id="cool.dingstock.mobile:id/common_titlebar_left_icon"]'
    look_all_shoes = '//*[@resource-id="cool.dingstock.mobile:id/gallery"]/android.view.ViewGroup[1]/androidx.appcompat.widget.LinearLayoutCompat[1]/android.widget.FrameLayout[1]'
    title = '//*[@resource-id="cool.dingstock.mobile:id/common_titlebar_title_tv"]'

    def into_yeezy_350(self):
        """进入yeezy350详情页"""
        self.click_xpath(self.yeezy_button)
        self.click_xpath(self.yeezy_350_button)

    def get_first_350_name(self):
        """第一双350名称"""
        return self.get_xpath_text(self.first_yeezy350_detail_name)

    def look_all_and_go_back(self):
        """查看全部系列产品后后点击返回"""
        self.click_xpath(self.look_all_shoes)
        self.swipe('up', 1)
        self.click_xpath(self.detail_back)
        return self.get_xpath_text(self.title)


